package com.itheima.Object.test1;

public class OBjectDeno2 {
    public static void main(String[] args) {
        String s1 = "abc";
        StringBuilder s2 = new StringBuilder("abc");
        //第一中当中比较的还是地址值,因为s1调用的equals方法,但是String类型当中看下面的注释代码,比较的还是==
        /*
          public boolean equals(Object anObject) {
        if (this == anObject) {
            return true;
        }
        if (anObject instanceof String) {
            String aString = (String)anObject;
            if (coder() == aString.coder()) {
                return isLatin1() ? StringLatin1.equals(value, aString.value)
                                  : StringUTF16.equals(value, aString.value);
            }
        }
        return false;
    }
         */
        System.out.println(s1.equals(s2)); //false
        //同理用s2去调用equals方法,StringBuilder里面都没有equals方法只能去父类object中找了,所以最终还是==
        System.out.println(s2.equals(s1));//false
    }
}

